import { createRouter, createWebHistory } from 'vue-router';
import Home from '../views/Home.vue';
import nav from '../views/nav/nav.vue';

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    beforeEnter: (to, from, next) => {
      var apps = document.querySelector('#app')
      apps.style = ''
      next();
    }
  },
  {
    path: '/nav',
    name: 'nav',
    component: nav,
    beforeEnter: (to, from, next) => {
      var apps = document.querySelector('#app')
      document.body.style.background = '#fff'
      document.title = '框架介绍'
      // apps.style.maxWidth = ''
      apps.style.minHeight = '100vh'
      apps.style.padding = '0'
      apps.style.margin = '0 80px 0 0'
      apps.style.flex = '1'
      next();
    }
  },
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
});

export default router;